
#include <cmath>
#include <cstdlib>
#include <math.h>
#include <vector>
#include <math.h>
#include "game.h"
#include "world.h"
#include "gamedrawer.h"

using namespace std;

Game::Game() {	
	world = new World();
	designate = false;
	designate_started = false;
}

Game::~Game() {

}

void Game::update() {
	world->update();
}

void Game::draw(){
	world->draw();
}

void Game::handleMouseInput(){
	if(mouse_left()){
		world->select();
	}
	else if(!mouse_left()){
		world->release();
	}
	else if(!mouse_left() && mouse_right()){
		world->deselect_all();
	}
}

void Game::handleKeyboardInput(unsigned char key,int x,int y){
	float cameraSpeed = 4;
	switch (key) {
		case 'w':
			moveCamera(0,-cameraSpeed);			
			break;
		case 'a':
			moveCamera(cameraSpeed,0);
			break;
		case 's':
			moveCamera(0,cameraSpeed);
			break;
		case 'd':
			moveCamera(-cameraSpeed,0);
			break;
		case 'c':
			world->order_convert();
			break;
		case 'x':
			world->order_toggle_active_state();
			break;
		case 'z':
			world->toggle_designate();
			break;
	}
	
}


